﻿using System;
using System.Collections;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Skyworth.CRM.Service.Entity;
using Skyworth.CRM.Common;
using Skyworth.CRM.Service.IDAL;
using Skyworth.CRM.Service.IBLL;

namespace Skyworth.CRM.BLL
{
    public class ModulesBLL : IModulesBLL
    {

        private IModulesDAL _modulesDAL;

        public ModulesBLL(IModulesDAL modulesDal)
        {
            _modulesDAL = modulesDal;
        }


        public void Add(Modules model)
        {
            _modulesDAL.Add(model);
        }

        public void Update(Modules model)
        {
            _modulesDAL.Update(model);
        }

        public DataTable Query(string strWhere)
        {
          return  _modulesDAL.Query(strWhere);
        }

        public DataTable GetPagesWithFunctionAndAuthorityByRole(int moduleId,int roleId)
        {
            return _modulesDAL.GetPagesWithFunctionAndAuthorityByRole(moduleId,roleId);
        }
        public DataTable GetPagesWithFinalFunctionAndAuthorityByUser(int moduleId, int userId)
        {
            return _modulesDAL.GetPagesWithFinalFunctionAndAuthorityByUser(moduleId, userId);
        }
        //public DataTable GetPagesAuthorityByUser(int parentPageId)
        //{
        //    return _modulesDAL.GetPagesAuthorityByUser(parentPageId);
        //}
        public DataTable GetPagesAuthorityByUser(int parentPageId, int userId)
        {
            return _modulesDAL.GetPagesAuthorityByUser(parentPageId, userId);
        }
        public DataTable GetModules()
        {
            return _modulesDAL.GetModules();
        }

        public DataTable GetModuleFunc(int userId)
        {
            return _modulesDAL.GetModuleFunc(userId);
        }

        public DataTable GetModules(int userId, int functionId)
        {
            return _modulesDAL.GetModules(userId, functionId);
        }
    }
}
